<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        function add(){
            var name2 = document.getElementById("name").value;
            var phone2 = document.getElementById("phone").value;
            var age2 = document.getElementById("age").value;
            var biaoge = document.getElementById("biaoge");

            var index=biaoge.rows.length;
            var newline=biaoge.insertRow(index);
            newline.id=new Date().getMilliseconds();
            var col1=newline.insertCell(0);
            var col2=newline.insertCell(1);
            var col3=newline.insertCell(2);
            var col4=newline.insertCell(3);
            col1.innerHTML=name2;
            col2.innerHTML=phone2;
            col3.innerHTML=age2;
            col4.innerHTML='<input type="button" value="删除" onclick="del('+newline.id+');"/>';
        }

        function del(rowId) {
            var row=document.getElementById(rowId);
            var biaoge=document.getElementById("biaoge");
            biaoge.deleteRow(row.rowIndex);
        }row.i

    </script>

    姓名：
    <input type="text" id="name"/>
    联系方式：
    <input type="test" id="phone"/>
    年龄：
    <input type="text" id="age"/>
    <input type="button"  value="添加" onclick="add();"/>
    <hr/>

    <table id="biaoge" border="1px" cellspacing="0px" width="30%">
        <tr>
            <th>姓名</th>
            <th>联系方式</th>
            <th>年龄</th>
            <th>操作</th>
        </tr>


    </table>

</body>
</html>